package com.yz.design.responsibilityDegin;

/**
 * 责任链模式
 * 它包含了一些命令对象和一系列的处理对象。每一个处理对象决定它能处理哪些命令对象，
 * 它也知道如何将它不能处理的命令对象传递给该链中的下一个处理对象。该模式还描述了往该处理链的末尾添加新的处理对象的方法。
 */
public class Main {

    public static void main(String[] args) {
        Message message = Message.builder().tag("A").build();

        AbstractMessageResponsibility<Message> handler = ResponsibilityFactory.getHandlerResponsibilityChain(
//                AResponsibility.class,
                BResponsibility.class,
                CResponsibility.class);
        handler.doSomething(message);

//        message.setTag("B");
//        ResponsibilityChain responsibilityChain = new ResponsibilityChain();
//        responsibilityChain.add(new AResponsibility()).add(new BResponsibility()).add(new CResponsibility());
//        responsibilityChain.doSomething(message);
    }



}